package com.cartoon.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.cartoon.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import model.CarttonKKDirectoryModel;
import pic.PicLoadManager;

public  class KKCartoonDirectoryAdapter extends BaseQuickAdapter<CarttonKKDirectoryModel.DataBean.TopicInfoBean.ComicsBean, BaseViewHolder> {
    public KKCartoonDirectoryAdapter(int layoutResId, @Nullable @org.jetbrains.annotations.Nullable List<CarttonKKDirectoryModel.DataBean.TopicInfoBean.ComicsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarttonKKDirectoryModel.DataBean.TopicInfoBean.ComicsBean item) {
        TextView tv_name = helper.itemView.findViewById(R.id.tv_name);
        ImageView pig = helper.itemView.findViewById(R.id.iv_pig);
        tv_name.setText(item.getTitle());
        tv_name.setSelected(true);
        PicLoadManager.loadPicture(item.getCover_image_url(),pig);

        if(item.getLocked()){
            helper.setText(R.id.tv_vip,"目前试看，后续可能会开放免费观看");
        }else {
            helper.setText(R.id.tv_vip,"");
        }
    }
}
